/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.util.List;
import model.Person;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 *
 * @author pasante
 */
public class PersonDAOHib extends HibernateDaoSupport implements PersonDAO {

    @Override
    public List getPersonList() {
        return getHibernateTemplate().find("from Person");
    }

    @Override
    public Person getPerson(int id) {
        return (Person) getHibernateTemplate().get(Person.class, id);
    }

    @Override
    public void savePerson(Person person) {
        this.getHibernateTemplate().saveOrUpdate(person);
    }

    @Override
    public void deletePerson(int id) {
        getHibernateTemplate().delete(getPerson(id));
    }
    
}
